<div [@routerTransition]>
  <div class="m-subheader">
    <div class="row align-items-center">
      <div class="mr-auto col-auto">
        <h3 class="m-subheader__title m-subheader__title--separator">
          <span>字典管理</span>
        </h3> 
      </div> 
    </div>
  </div>
  <div class="m-content">
    <div class="row">
      <div class="col-lg-2">
          <div class="m-portlet m-portlet--mobile" style="margin-bottom: 0px;">
              <div class="m-portlet__head">
                  <div class="m-portlet__head-caption">
                      <div class="m-portlet__head-title">
                          <h3 class="m-portlet__head-text">
                             字典分类
                          </h3>
                      </div>
                  </div>
                  <div class="m-portlet__head-tools">
                      <button (click)="createDataItem()" class="btn btn-primary"><i class="fa fa-plus"></i>新增</button>
                  </div>
              </div>
              <div class="m-portlet__body" style="height: 658px;padding: 0;">
                  <p-tree [value]="itemAyy" name="itemTree" selectionMode="single" [(selection)]="selectedOu" (onNodeSelect)="nodeSelect($event)" [contextMenu]="ouContextMenu"></p-tree>
                  <p-contextMenu #ouContextMenu [model]="ouContextMenuItems" appendTo="body" baseZIndex="99999"></p-contextMenu>
               
              </div>
          </div>
      </div>
      <div class="col-lg-10" style="padding: 0;">
        <div class="m-portlet m-portlet--mobile" style="margin-bottom: 0px;">
          <div class="m-portlet__body"  style="height: 724px;">
            <form class="horizontal-form" autocomplete="off">
              <div class="m-form m-form--label-align-right">
                <div class="row align-items-center m--margin-bottom-10">
                  <div class="col-xl-9" style="padding: 0;">
                    <div class="form-group m-form__group align-items-center">
                      <div class="input-group col-lg-9" style="padding: 0;">
                        <input [(ngModel)]="filterText" name="filterText" autoFocus class="form-control m-input"
                          [placeholder]="l('SearchWithThreeDot')" type="text">
                        <span class="input-group-btn">
                          <button (click)="getDataItemDetail()" class="btn btn-primary" type="submit"><i
                              class="flaticon-search-1" [attr.aria-label]="l('Search')"></i></button>
                        </span>
                      </div> 
                    </div>
                  </div>
                  <div class="col-lg-3">
                      <button (click)="createDataItemDetail()" class="btn btn-primary"><i class="fa fa-plus"></i> 新增字典</button>
                      <button class="btn btn-metal" (click)="getDataItemDetail()"><i class="fa fa-sync"></i>刷新 </button> 
                   </div> 
                </div> 
              </div>
            </form>

            <div class="row align-items-center">
              <!--<Primeng-TurboTable-Start>-->
              <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                <p-table #dataTable (onLazyLoad)="getDataItemDetail($event)" [value]="primengTableHelper.records"
                  rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                  [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                  [resizableColumns]="primengTableHelper.resizableColumns">
                  <ng-template pTemplate="header">
                    <tr>
                      <th style="width: 130px">
                        操作
                      </th>
                      <th style="width: 100px">
                        序号
                      </th>
                      <th style="width: 230px">
                        分类名称
                      </th>
                      <th style="width: 150px">
                        编码
                      </th>
                      <th style="width: 230px">
                        名称
                      </th>
                      <th style="width: 150px">
                        值
                      </th>
                      <th style="width: 250px">
                        备注
                      </th>
                    </tr>
                  </ng-template>
                  <ng-template pTemplate="body" let-record="$implicit"  let-ri='rowIndex'>
                    <tr>
                      <td style="width: 130px">
                        <div class="btn-group dropdown" dropdown container="body">
                          <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                            <i class="fa fa-cog"></i><span class="caret"></span>
                            操作
                          </button>
                          <ul class="dropdown-menu" *dropdownMenu>
                            <li>
                              <a href="javascript:;" *ngIf="'Pages.Suppliers.Edit' | permission"
                                (click)="DataItemDetailCreate.show(record.id,record.itemId)">编辑</a>
                            </li>
                            <li>
                              <a href="javascript:;" *ngIf="'Pages.Suppliers.Delete' | permission"
                                (click)="deleteDateItemDetail(record)">删除</a>
                            </li>
                          </ul>
                        </div>
                      </td>
                      <th style="width: 100px">
                        {{ri+1}}
                      </th>
                      <td style="width: 230px">
                        <div [ngSwitch]="record.dataItem">
                          <div *ngSwitchCase="">
                            <div class="m-loader m-loader--warning" style="width: 30px; display: inline-block;">
                            </div>
                          </div>
                          <div *ngSwitchDefault>
                            <span class="m-badge m-badge--info m-badge--dot"></span>&nbsp;
                            <span class="m--font-bold">
                              {{record.dataItem}}</span>
                          </div>
                        </div>
                      </td>
                      <td style="width: 150px">
                        {{record.itemCode}}
                      </td>
                      <td style="width: 230px">
                        {{record.itemName}}
                      </td>
                      <td style="width: 150px">
                        {{record.itemValue}}
                      </td>
                      <td style="width: 250px">
                        {{record.description}}
                      </td>
                    </tr>
                  </ng-template>
                </p-table>
                <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                  {{'NoData' | localize}}
                </div>
                <div class="primeng-paging-container">
                  <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                    (onPageChange)="getDataItemDetail($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">

                  </p-paginator>
                  <span class="total-records-count">
                    {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                  </span>
                </div>
              </div>
              <!--<Primeng-TurboTable-End>-->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <DataItemDetailCreate #DataItemDetailCreate (modalSave)="getDataItemDetail()"></DataItemDetailCreate>
  <DataItemCreate #DataItemCreate (modalSave)="getDataItemTree()"></DataItemCreate>
</div>